package com.test.jdk9.newStream;

import java.util.List;

/**
 * @Description: TODO
 * @Author 赵侠客
 * @Date 2023/6/3
 **/
public class TakeWhile {
    public static void main(String[] args) {
        List<Integer> list=List.of(1,2,3,2,1);
        list.stream().filter(x->x<2).forEach(System.out::print);
        System.out.println("------------------------------------");
        list.stream().takeWhile(x->x<2).forEach(System.out::print);
        System.out.println("------------------------------------");
        list.stream().dropWhile(x->x<2).forEach(System.out::print);
    }
}
